Skip to content

nip52: add NIP-52 Calendar Events support#1283

Draft
ozgb wants to merge 8 commits into
rust-nostr:masterfrom
ozgb:nip52-calendar-events
Draft

nip52: add NIP-52 Calendar Events support#1283
ozgb wants to merge 8 commits into
rust-nostr:masterfrom
ozgb:nip52-calendar-events

Conversation

@ozgb

@ozgb ozgb commented Mar 5, 2026

Copy link
Copy Markdown

Summary

  • Add NIP-52 Calendar Events support: calendar event (date-based and time-based), calendar, RSVP, and event builder helpers
  • Implements spec-compliant tag handling including d tag, repeatable locations/participants, geohash, and RSVP validation
  • Includes comprehensive test coverage

Test plan

  • Unit tests for all event types (calendar, date event, time event, RSVP)
  • Round-trip serialization tests
  • cargo test passes
  • cargo clippy clean

ozgb added 8 commits March 5, 2026 20:08
Add support for NIP-52 (Calendar Events) with four event kinds:
- DateBasedCalendarEvent (31922)
- TimeBasedCalendarEvent (31923)
- Calendar (31924)
- CalendarEventRsvp (31925)

Includes new TagKind variants (Start, End, Location), a Location
TagStandard variant, and full tag round-trip conversion for all
four structs with validation and tests.

Closes rust-nostr#829
… author)

- Add uppercase D tags to TimeBasedCalendarEvent for day-granularity relay filtering
- Change location from Option<String> to Vec<String> (spec says "repeated")
- Add optional author (p tag) to CalendarEventRsvp for event author pubkey
- Clean up RSVP deserialization to use Option instead of placeholder Coordinate
- M1: clarify `coordinates` doc comments as optional
- M2: validate YYYY-MM-DD format for DateBasedCalendarEvent start/end
- M4: return InvalidTimestamp instead of misleading StartMissing
- m3: document that event description lives in Nostr event content field
- m4: implement std::error::Error behind std feature flag
- Add tests for date validation, invalid timestamps, and error paths
- Add EventBuilder convenience methods for all 4 NIP-52 event kinds
- Replace Vec::new() with Vec::with_capacity() in tag serialization
- Remove std::error::Error impl to match NIP-53 consistency
- Fix RSVP status/FreeBusy parsing to return errors instead of silently skipping
- Add comments explaining uppercase:false match arms
- Add tests for multi-day D tags, RSVP with all fields, calendar with
  multiple coordinates, and unknown RSVP status error
@ozgb ozgb marked this pull request as ready for review March 5, 2026 21:01
@TheAwiteb

Copy link
Copy Markdown
Member

Hi @ozgb, thank you for your work, but we no longer update the tags until we done this refactor #907. it also block #1216 and #1204.

I'll make this PR a draft and you can continue work on it after #907 closed.

@TheAwiteb TheAwiteb marked this pull request as draft March 5, 2026 21:41
@ozgb

ozgb commented Mar 6, 2026

Copy link
Copy Markdown
Author

Hi @ozgb, thank you for your work, but we no longer update the tags until we done this refactor #907. it also block #1216 and #1204.

I'll make this PR a draft and you can continue work on it after #907 closed.

Thanks @TheAwiteb - is that issue being worked on? I can try to resolve it if not - I saw you were working on it but unassigned yourself a couple of weeks ago

@TheAwiteb

Copy link
Copy Markdown
Member

is that issue being worked on?

Not yet, but Yuki will work on it soon, around the next week. Thank you

@TheAwiteb

Copy link
Copy Markdown
Member

Hi @ozgb, the tag refactoring in #1347 has been merged, so you can now continue your work 🫡

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants